home *** CD-ROM | disk | FTP | other *** search
- #include "inc.h"
- #include "defs.h"
- #include "req_manx_5.c"
- #include "zz_pointer.h"
- #include <exec/memory.h>
-
- extern struct Image Image1;
- extern struct Gadget Gadget1;
- extern struct PropInfo Gadget1SInfo;
- extern int initsing[88];
-
- struct GetStringStruct strstruct;
-
- char *WaveName[256] =
- { "Sine 1st","Sine 2nd","Sine 3rd","Sine 4th","Sine 5th","Sine 6th","Sine 7th",
- "Sine 8th","Sine 9th","Sine 10th","Sine 11th","Sine 12th","Sine 16th","Saw 1",
- "Saw 2","Saw 3","Saw 4","Saw 5","Saw 6","Saw 7","Saw 8","Saw 9","Saw 10",
- "Saw 11","Saw 12","Saw 13","Saw 14","Saw 15","Saw 16","Saw 17","Saw 18","Saw 19",
- "Square 1","Square 2","Square 3","Square 4","Square 5","Inverse-Saw","Triangle",
- "Random",
- "French Horn","String 1","String 2","String Pad","Piano 1","El.Grand",
- "E.Piano 1","E.Piano 2","E.Piano 3","Clavi","Vibe","A.Guitar","F.Guitar 1",
- "F.Guitar 2","Ac Bass 1","Ac Bass 2","Digi Bass 1","Pick Bass","Digi Bass 2",
- "Round Bass","Fretless 1","Fretless 2","Flute","Panflute","Harmonica","Glocken",
- "Tine","Harp","Marimba","E.Tom","Log Drum","Jazz Organ 1","Mello Pad",
- "Synth Solo","Synth 2",
- "French Horn 1","French Horn 2","Brass 1","Brass 2","Brass 3","Brass 4",
- "Trumpet 1","Trumpet 2","Violin","String","Piano 1","Piano 2","Piano 3",
- "Piano 2b","Piano 3b","Piano 4","Piano 4b","El.Grand","E.Piano 1","E.Piano 2",
- "E.Piano 3","Clavi","Harpsichord","Vibe","A.Guitar","F.Guitar","Strat 1",
- "Strat 2","Ac Bass","Pull Bass 1","Pull Bass 2","Round Bass","Slap Bass 1",
- "Slap Bass 2","Slap Bass 3","Fretless 1","Fretless 2","Synth Bass 1",
- "Synth Bass 2","Harmonica","Clarinet 1","Clarinet 2","Oboe 1","Oboe 2",
- "Shakuhachi","Oriental Bell 1","Oriental Bell 2","Bell","Koto","Sitar",
- "E.Tom","Log Drum 1","Log Drum 2","Steel Drum 1","Steel Drum 2","Voice 1",
- "Voice 2","Accordion 1","Accordion 2","Jazz Organ 2","Rock Organ 1","Draw Bar 1",
- "Draw Bar 2","Pipe Organ 1","Pipe Organ 2","Rock Organ 2","Synth Solo 1",
- "Synth Solo 2","Synth 2","Synth 2b","Synth 3",
- "Brass 1","Brass 2","Orchestra","Piano 1","Piano 4","E.Piano 1","E.Piano 1b",
- "E.Piano 2","E.Piano 3","Clavi","Harpsichord 1","Harpsichord 2","Vibe",
- "Digi Bass 1","Digi Bass 2","Digi Bass 2b","Pick Bass","Glocken 1","Glocken 2",
- "Tine 1","Tine 2","Tine 3","Tube Bell 1","Tube Bell 2","Tube Bell 3",
- "Xylophone 1","Xylophone 2","Harp","Koto","Sitar 1","Sitar 2","Kalimba 1",
- "Kalimba 2","Kalimba 3","Log Drum","Steel Drum","Pipe Organ 3","Pipe Organ 3b",
- "Synth 1","Synth 2","Synth 3","Synth 3b","Synth 4","Synth 4b",
- "Clavi","Digi Bass 1","Digi Bass 2","Pick Bass 1","Pick Bass 2","Round Bass 1",
- "Round Bass 2","Harmonica 1","Harmonica 2","Harp","Koto","Sitar","Marimba",
- "Synth 1",
- "Bass Drum","Ac Snare","Tight Snare","E.Snare","Rim","Ac Tom","HiHat","Crash",
- "Ride","Strat Guitar","Fuzz Mute","A.Guitar","F.Guitar","Guitar Harmo","Pull Bass",
- "Bass Harmo","Bowed String","String Attack","String Sus","Pizzicato","Piano",
- "El.Grand","Piano Noise","Trumpet","Shakuhachi Att","Shakuhachi Sus","Panflute Att",
- "Panflute Sus","Voice","White Noise",
- "String Loop","Shakuhachi Loop","Panflute Loop","Voice Loop","White Noise Loop",
- "Ac Snare Loop","F.Guitar Loop","Pull Bass Loop",
- "Omni Loop 1","Omni Loop 2","Omni Loop 3","Omni Loop 4","Omni Loop 5","Omni Loop 6",
- "Omni Loop 7","Omni Loop 8",
- "Ac Snare Rev","Ac Tom Rev","F.Guitar Rev",
- "HiHat Alt","Crash Alt","Piano Noise Alt"
- };
-
- char *ShapeName[4]={"Tri","Saw","Sqr","Rnd"};
- char *ModName[6]={"Off","2>1","1>2","Off","4>3","3>4"};
- char *PolyName[3]={"Poly 1","Poly 2"," Solo "};
- extern char *ToneName[12];
-
- WORD areabuffer[250];
- struct TmpRas tmp;
- struct AreaInfo areainfo;
- long mem;
-
- int VCvec[8][8] =
- { 1,32,1,32,130,1,130,1, /* die Velocity-Kurven */
- 1,32,43,18,86,6,130,1,
- 1,32,43,27,86,18,130,1,
- 1,32,78,26,104,17,130,1,
- 1,32,60,32,112,3,130,1,
- 1,32,31,28,100,5,130,1,
- 1,32,30,16,100,9,130,1,
- 1,1,65,1,100,32,130,32
- };
-
- int KSCvec[5][8] =
- { 1,32,1,32,130,1,130,1, /* die 5 KS-Kurven */
- 1,32,43,27,86,18,130,1,
- 1,32,43,18,86,6,130,1,
- 1,32,50,32,80,1,130,1,
- 1,32,65,32,65,1,130,1
- };
-
- int volume;
- int polymode;
- int sources;
- int ams1,ams2;
- int prsfreq;
- int vibdepth;
- int vibpres;
- int pitchbend;
- int lfospeed;
- int lfoshape;
- int kscurve;
- int vibwheel;
- int autodepth;
- int autotime;
- int autobendvel;
- int autobendks;
-
- int mute[4];
- int fine[4];
- int coarse[4];
- int wave[4];
- int keytrack[4];
- int vibabend[4];
- int prsonfreq[4];
- int velcurve[4];
- int envlevel[4];
- int envdelay[4];
- int envattack[4];
- int envdecay[4];
- int envsustain[4];
- int envrelease[4];
- int levelmodvel[4];
- int levelmodprs[4];
- int levelmodks[4];
- int timemodvel[4];
- int timemodks[4];
- int freqksfreq[4];
-
- extern int oldenvlevel[4];
- extern int oldenvdelay[4];
- extern int oldenvattack[4];
- extern int oldenvdecay[4];
- extern int oldenvsustain[4];
- extern int oldenvrelease[4];
-
- unsigned char f[88];
- int oldvol;
-
- /* singleed.c */
- void DecodeSingle(const int nr);
- void SingleEd(const int nr);
- void SingleProp(int current, int max, int flag,int nr);
- void EncodeSingle(const int nr);
- void NumBox(int x, int y,int wide,char *, int val);
- int Check(int x, int y, int xmin, int xmax, int ymin, int ymax);
- void DisplaySingleLine(int pos);
- void MakeBox(struct Window *win,long x1,long y1,long x2,long y2);
- void MakeDBox(struct Window *win,long x1,long y1,long x2,long y2);
- void DisplaySingleValue(const int,const long);
- void ReturnValue(const int,const int,const long );
- void SingleParameterSend(int nr,int src,int val);
- void TestSound(int channel);
- void Oscillators(void);
- void Swap(int *a,int *b);
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void DecodeSingle(const int nr)
- {
- int i,S[88];
-
- for (i=0;i<=87;i++) S[i]=s[nr/32][nr%32][i];
-
- volume =S[10];
- polymode=S[11] & 3;
- sources =(S[11] & 4) >> 2;
- ams1 =(S[11] & 24) >> 3;
- ams2 =(S[11] & 96) >> 5;
-
- prsfreq =S[12];
- vibdepth =S[13];
- vibpres =S[14];
- pitchbend =S[15];
- lfospeed =S[16];
-
- lfoshape =S[17]&3;
- kscurve =(S[17]&28)>>2;
- vibwheel =(S[17]&96)>>5;
-
- autodepth =S[18];
- autotime =S[19];
- autobendvel =S[20];
- autobendks =S[21];
-
- mute[0] =(S[22]&1);
- mute[1] =(S[22]&2)>>1;
- mute[2] =(S[22]&4)>>2;
- mute[3] =(S[22]&8)>>3;
-
- for (i=0;i<=3;i++)
- {
- fine[i] =S[23+i];
- coarse[i] =S[27+i];
- wave[i] =S[31+i]+(S[35+i]&1)*128;
- keytrack[i] =(S[35+i]&2)>>1;
- vibabend[i] =(S[35+i]&4)>>2;
- prsonfreq[i] =(S[35+i]&8)>>3;
- velcurve[i] =(S[35+i]&112)>>4;
- envlevel[i] =S[39+i];
- envdelay[i] =S[43+i];
- envattack[i] =S[47+i];
- envdecay[i] =S[51+i];
- envsustain[i] =S[55+i];
- envrelease[i] =S[59+i];
-
- levelmodvel[i] =S[63+i];
- levelmodprs[i] =S[67+i];
- levelmodks[i] =S[71+i];
- timemodvel[i] =S[75+i];
- timemodks[i] =S[79+i];
- freqksfreq[i] =S[83+i];
- }
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void SingleEd(const int nr)
- {
- int i,refresh;
- int x,y;
- char name[11],title[255];
-
- oldvol=Gadget1SInfo.VertPot;
- for (i=0;i<=87;i++) f[i]=s[nr/32][nr%32][i]; /* Daten sichern für Cancel */
-
- DecodeSingle(nr);
-
- for (i=0;i<=3;i++)
- {
- oldenvlevel[i]= -1;
- oldenvdelay[i]= -1;
- oldenvattack[i]= -1;
- oldenvdecay[i]= -1;
- oldenvsustain[i]=-1;
- oldenvrelease[i]=-1;
- }
-
- SetAPen(win->RPort,0);
- SetBPen(win->RPort,0);
- SetOPen(win->RPort,0);
- RectFill(win->RPort,10,11,616,250);
-
- mem=AllocRaster(640,256);
- InitArea(&areainfo,areabuffer,100);
- InitTmpRas(&tmp,mem,RASSIZE(640,256));
- rp->TmpRas=&tmp;
- rp->AreaInfo=&areainfo;
-
- refresh=0;
-
- aufbau: ;
- for (i=0;i<=9;i++) name[i]=s[nr/32][nr%32][i]; name[10]='\0';
- strcpy(title,"KAWAI K1-II Librarian...Singlepatch-Editor Selected: ");
- strcat(title,name);
- SetTitle(title);
-
- Print(win,571,21," O K ");
- MakeDBox(win,567,13,614,23);
-
- Print(win,562,35,"Undo");
- MakeDBox(win,548,27,606,37);
-
- Print(win,557,50,"Print");
- MakeDBox(win,548,42,606,52);
-
- Print(win,553,65,"Rename");
- MakeDBox(win,548,57,606,67);
-
- Print(win,562,80,"Init");
- MakeDBox(win,548,72,606,82);
-
- Print(win,562,95,"Test");
- MakeDBox(win,548,87,606,97);
-
- Print(win,497,35,"Load");
- MakeDBox(win,483,27,541,37);
-
- Print(win,497,50,"Save");
- MakeDBox(win,483,42,541,52);
-
- Print(win,488,65,"P-Copy");
- MakeDBox(win,483,57,541,67);
-
- Print(win,488,80,"P-Swap");
- MakeDBox(win,483,72,541,82);
-
- Print(win,488,95,"Oscil.");
- MakeDBox(win,483,87,541,97);
-
- Gadget1SInfo.VertPot=65535-volume*656;
- RefreshGadgets(&Gadget1,win,NULL);
- TransmitSingleSound(nr);
-
- start: ;
- for(i=0;i<=4;i++) DisplaySingleLine(i);
- EnvDisplay();
-
- if (refresh != 0)
- {
- Forbid();
- BeginRefresh(win);
- RefreshWindowFrame(win);
- EndRefresh(win,i);
- Permit();
- refresh=0;
- }
-
- Loop: ;
- MODWIN
- WaitPort(win->UserPort);
- while(mesg = (struct IntuiMessage *) GetMsg(win->UserPort))
- {
- class=mesg->Class;
- code=mesg->Code;
- x=mesg->MouseX;
- y=mesg->MouseY;
- ReplyMsg((struct Message *)mesg);
-
- switch(class)
- {
- case ACTIVEWINDOW:
- {
- if (SCREEN==NULL) SetColours();
- break;
- }
-
- case INACTIVEWINDOW:
- {
- if (SCREEN==NULL) SetOldColours();
- break;
- }
-
- case CLOSEWINDOW:
- {
- if (MyReq("Do really want to quit ?"," Yes ","Oh no")==TRUE)
- {
- FreeRaster(mem,640,256);
- CloseStuff();
- }
- break;
- }
-
- case NEWSIZE:
- {
- refresh=1;
- goto aufbau;
- break;
- }
-
- case GADGETDOWN:
- {
- while(Gadget1.Activation & SELECTED || Gadget1.Flags & SELECTED)
- {
- volume=Gadget1SInfo.VertPot;
- volume=((65535-volume)*99)/65535;
- SingleParameterSend(3,0,volume);
- NumBox(20,85,130,"Volume :",volume+1);
- }
- break;
- }
-
- case GADGETUP:
- {
- volume=Gadget1SInfo.VertPot;
- volume=((65535-volume)*99)/65535;
- SingleParameterSend(3,0,volume);
- NumBox(20,85,130,"Volume :",volume+1);
- break;
- }
-
- case MOUSEBUTTONS:
- {
-
- if (code==MENUDOWN)
- {
- /* EncodeSingle(nr);
- SetAPen(win->RPort,0);
- SetBPen(win->RPort,0);
- SetOPen(win->RPort,0);
- RectFill(win->RPort,10,11,616,250);
- Gadget1SInfo.VertPot=oldvol;
- RefreshGadgets(&Gadget1,win,NULL);
- FreeRaster(mem,640,256);
- multi=0;
- Display();
- return(); */
- }
-
- if (code==SELECTDOWN)
- {
- if (Check(x,y,567,614,13,23)) /* OK */
- {
- EncodeSingle(nr);
- SetAPen(win->RPort,0);
- SetBPen(win->RPort,0);
- SetOPen(win->RPort,0);
- RectFill(win->RPort,10,11,616,250);
- Gadget1SInfo.VertPot=oldvol;
- RefreshGadgets(&Gadget1,win,NULL);
- FreeRaster(mem,640,256);
- multi=0;
- Display();
- return();
- }
-
- if (Check(x,y,548,606,27,37)) /* Undo */
- {
- int j;
-
- if (MyReq("Are you shure ?"," Yes ","Oh no"))
- {
- for (j=0;j<=87;j++) s[nr/32][nr%32][j]=f[j];
- DecodeSingle(nr);
- envlevel[0]++; EnvDisplay();
- envlevel[0]--; EnvDisplay();
- goto aufbau;
- }
- }
-
- if (Check(x,y,548,606,42,52)) /* Print */
- {
- PrintSingle(nr);
- break;
- }
-
- if (Check(x,y,548,606,57,67)) /* Rename */
- {
- char st[20];
- int i;
-
- strstruct.titlebar =NULL;
- strstruct.Window =win;
- strstruct.visiblesize =11;
- strstruct.versionnumber =REQVERSION;
- strstruct.flags =NULL;
- strstruct.rfu1 =NULL;
- strstruct.rfu2 =NULL;
- strstruct.rfu3 =NULL;
-
- for (i=0;i<=9;i++) st[i]=s[nr/32][nr%32][i];
- for (i=9;i>=0;i--)
- {
- if (st[i] == 32) st[i]=0;
- else break;
- }
- st[10]='\0';
- strstruct.stringbuffer =&st[0];
- strstruct.stringsize =11;
-
- if (NewGetString(&strstruct))
- {
- int f;
-
- for (f=0,i=0;i<=9;i++)
- {
- if (f == 0 && st[i] != 0) { s[nr/32][nr%32][i]=st[i]; }
- else {f=1; s[nr/32][nr%32][i]=32; }
- }
- EncodeSingle(nr);
- }
- goto aufbau;
- }
-
- if (Check(x,y,548,606,72,82)) /* Initialize */
- {
- int j;
-
- if (MyReq("Are you shure ?"," Yes ","Oh no"))
- {
- for (j=0;j<=87;j++) s[nr/32][nr%32][j]=initsing[j];
- DecodeSingle(nr);
- envlevel[0]++; EnvDisplay();
- envlevel[0]--; EnvDisplay();
- goto aufbau;
- }
- }
-
- if (Check(x,y,548,606,87,97)) /* Patch testen */
- {
- TestSound(MASTERCHANNEL);
- goto aufbau;
- }
-
-
- if (Check(x,y,483,541,27,37)) /* Load */
- {
- LoadSound(nr+1000);
- DecodeSingle(nr);
- TransmitSingleSound(nr);
-
- goto aufbau;
- }
-
- if (Check(x,y,483,541,42,52)) /* Save */
- {
- SaveSound(nr);
-
- goto aufbau;
- }
-
- if (Check(x,y,483,541,57,67)) /* P-Copy */
- {
- int mx,my;
-
- Make_SingleWindow("Select patch to copy to...");
- DisplaySingleEdWindow();
- loop: WaitPort(win3->UserPort);
- mesg=(struct IntuiMessage *) GetMsg(win3->UserPort);
- mx=mesg->MouseX;
- my=mesg->MouseY;
-
- if (mesg->Class == CLOSEWINDOW)
- {
- ReplyMsg((struct Message *)mesg);
- CloseWindow(win3);
- goto start;
- }
-
- if (mesg->Class == MOUSEBUTTONS && mesg->Code == SELECTDOWN)
- {
- if (mx>15 && mx<415 && my>15 && my<175)
- {
- int num;
-
- if (mx>15 && mx<215) num=(my-15)/10*2+((mx<115)?0:1);
- if (mx>215 && mx<415) num=32+(my-15)/10*2+((mx<315)?0:1);
- ReplyMsg((struct Message *)mesg);
- CloseWindow(win3);
- EncodeSingle(nr);
- for (i=0;i<=87;i++) s[num/32][num%32][i]=s[nr/32][nr%32][i];
- TransmitSingleSound(num);
- ProgChange(nr);
- goto Loop;
- }
- else
- {
- ReplyMsg((struct Message *)mesg);
- goto loop;
- }
- }
- ReplyMsg((struct Message *)mesg);
- goto loop;
- goto aufbau;
- }
-
- if (Check(x,y,483,541,72,82)) /* P-Swap */
- {
- int mx,my;
-
- Make_SingleWindow("Select patch to swap with...");
- DisplaySingleEdWindow();
- loop1: WaitPort(win3->UserPort);
- mesg=(struct IntuiMessage *) GetMsg(win3->UserPort);
- mx=mesg->MouseX;
- my=mesg->MouseY;
-
- if (mesg->Class == CLOSEWINDOW)
- {
- ReplyMsg((struct Message *)mesg);
- CloseWindow(win3);
- goto start;
- }
-
- if (mesg->Class == MOUSEBUTTONS && mesg->Code == SELECTDOWN)
- {
- if (mx>15 && mx<415 && my>15 && my<175)
- {
- int num;
-
- if (mx>15 && mx<215) num=(my-15)/10*2+((mx<115)?0:1);
- if (mx>215 && mx<415) num=32+(my-15)/10*2+((mx<315)?0:1);
- ReplyMsg((struct Message *)mesg);
- CloseWindow(win3);
- EncodeSingle(nr);
- for (i=0;i<=87;i++)
- {
- int h;
- h=s[num/32][num%32][i];
- s[num/32][num%32][i]=s[nr/32][nr%32][i];
- s[nr/32][nr%32][i]=h;
- }
- TransmitSingleSound(nr);
- TransmitSingleSound(num);
- ProgChange(nr);
- DecodeSingle(nr);
- goto aufbau;
- }
- else
- {
- ReplyMsg((struct Message *)mesg);
- goto loop1;
- }
- }
- ReplyMsg((struct Message *)mesg);
- goto loop1;
- goto aufbau;
- }
-
- if (Check(x,y,483,541,87,97)) /* Oscillators */
- {
- Oscillators();
- goto start;
- }
-
- if (Check(x,y,260,455,20,75)) /* Hüllkurve editieren */
- {
- EnvEdit(nr);
- goto aufbau;
- }
-
- for (i=0;i<=2*(sources+1)-1;i++)
- {
- if (Check(x,y,150*i+20,150*i+53,110,120))
- {
- mute[i]=mute[i]==1 ? 0 : 1;
- envlevel[i]++;EnvDisplay();
- envlevel[i]--;EnvDisplay();
- DisplaySingleLine(i);
- EncodeSingle(nr);
- goto Loop;
- }
-
- if (Check(x,y,150*i+53,150*i+86,110,120))
- {
- if (keytrack[i]==1) keytrack[i]=0;
- else
- {
- keytrack[i]=1;
- if (coarse[i]<60 || coarse[i]>108) coarse[i]=84;
- }
- SingleParameterSend(31,i,keytrack[i]);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+86,150*i+119,110,120))
- {
- vibabend[i]=vibabend[i]==1 ? 0 : 1;
- SingleParameterSend(32,i,vibabend[i]);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+119,150*i+152,110,120))
- {
- prsonfreq[i]=prsonfreq[i]==1 ? 0 : 1;
- SingleParameterSend(33,i,prsonfreq[i]);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+170,150,160))
- {
- SingleProp(wave[i],255,0,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+110,140,150))
- {
- SingleProp(envlevel[i],100,1,i);
- DisplaySingleLine(i);
- EnvDisplay();
- goto Loop;
- }
-
- if (Check(x,y,150*i+10,150*i+40,175,185))
- {
- SingleProp(envdelay[i],100,2,i);
- DisplaySingleLine(i);
- EnvDisplay();
- goto Loop;
- }
-
- if (Check(x,y,150*i+40,150*i+70,175,185))
- {
- SingleProp(envattack[i],100,3,i);
- DisplaySingleLine(i);
- EnvDisplay();
- goto Loop;
- }
-
- if (Check(x,y,150*i+70,150*i+100,175,185))
- {
- SingleProp(envdecay[i],100,4,i);
- EnvDisplay();
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+100,150*i+130,175,185))
- {
- SingleProp(envsustain[i],100,5,i);
- EnvDisplay();
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+130,150*i+160,175,185))
- {
- SingleProp(envrelease[i],100,6,i);
- EnvDisplay();
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+155,190,200))
- {
- SingleProp(levelmodvel[i],100,7,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+155,200,210))
- {
- SingleProp(levelmodprs[i],100,8,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+155,210,220))
- {
- SingleProp(levelmodks[i],100,9,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+155,220,230))
- {
- SingleProp(timemodvel[i],100,10,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+155,230,240))
- {
- SingleProp(timemodks[i],100,11,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+155,240,250))
- {
- SingleProp(freqksfreq[i],100,12,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+110,120,130))
- {
- if (keytrack[i]==1) SingleProp(coarse[i]-60,48,13,i);
- if (keytrack[i]==0) SingleProp(coarse[i],127,15,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+20,150*i+110,130,140))
- {
- SingleProp(fine[i],100,14,i);
- DisplaySingleLine(i);
- goto Loop;
- }
-
- if (Check(x,y,150*i+110,150*i+155,120,150))
- {
- velcurve[i]++;
- if (velcurve[i]>7) velcurve[i]=0;
- SingleParameterSend(47,i,velcurve[i]);
- DisplaySingleLine(i);
- goto Loop;
- }
- }
-
- /***********/
- /* Vibrato */
- /***********/
-
- if (Check(x,y,20,150,20,30))
- {
- lfoshape++;
- if (lfoshape>3) lfoshape=0;
- SingleParameterSend(17,0,lfoshape);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,20,150,30,40))
- {
- SingleProp(lfospeed,100,21,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,20,150,40,50))
- {
- SingleProp(vibdepth,100,22,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,20,150,50,60))
- {
- SingleProp(vibpres,100,23,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,20,150,60,70))
- {
- if (vibwheel==0) vibwheel=1;
- else vibwheel=0;
- SingleParameterSend(19,0,vibwheel);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- /************/
- /* Auto-Bend*/
- /************/
-
- if (Check(x,y,150,260,20,30))
- {
- SingleProp(autodepth,100,30,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,150,260,30,40))
- {
- SingleProp(autotime,100,31,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,150,260,40,50))
- {
- SingleProp(autobendvel,100,32,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,150,260,50,60))
- {
- SingleProp(autobendks,100,33,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,150,260,60,70))
- {
- SingleProp(prsfreq,100,41,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- /*************/
- /* Pitchbend */
- /*************/
-
- if (Check(x,y,20,150,75,85))
- {
- SingleProp(pitchbend,12,40,0);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,20,150,85,95))
- {
- SingleProp(volume,99,42,0);
- NumBox(20,85,130,"Volume :",volume+1);
- Gadget1SInfo.VertPot=65535-volume*656;
- RefreshGadgets(&Gadget1,win,NULL);
- goto Loop;
- }
-
- /**************/
- /* Modulation */
- /**************/
-
- if (Check(x,y,150,260,75,85))
- {
- ams1++;
- if (ams1>2) ams1=0;
- SingleParameterSend(36,0,ams1);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,150,260,85,95))
- {
- ams2++;
- if (ams2>2) ams2=0;
- SingleParameterSend(37,0,ams2);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- /*************/
- /* Poly-Mode */
- /*************/
-
- if (Check(x,y,260,390,75,85))
- {
- polymode++;
- if (polymode>2) polymode=0;
- SingleParameterSend(27,0,polymode);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- if (Check(x,y,260,390,85,95))
- {
- sources++;
- if (sources>1) sources=0;
- oldenvlevel[0]=-1;
- EnvDisplay();
- for (i=2;i<=4;i++) DisplaySingleLine(i);
- SingleParameterSend(14,0,sources);
- EnvDisplay();
- goto Loop;
- }
-
- if (Check(x,y,390,455,75,95))
- {
- kscurve++;
- if (kscurve>4) kscurve=0;
- SingleParameterSend(26,0,kscurve);
- DisplaySingleLine(4);
- goto Loop;
- }
-
- } /* of SELECTDOWN */
- } /* of case MOUSEBUTTONS */
-
- default: break;
- }
- }
- goto Loop;
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void SingleProp(int current,int max,int flag,int nr)
- {
- struct Gadget gad;
- struct PropInfo prop;
- char str[80];
- long val;
-
- Make_PropWindow(current != 0 ? 120*current/max+6 : 12);
-
- prop.Flags=AUTOKNOB+FREEHORIZ;
- prop.HorizPot=0;
- prop.VertPot=-1;
- prop.HorizBody=65535/max;
- prop.VertBody=-1;
-
- gad.NextGadget=NULL;
- gad.LeftEdge=8;
- gad.TopEdge=12;
- gad.Width=120;
- gad.Height=10;
- gad.Flags=GADGHBOX;
- gad.Activation=RELVERIFY+GADGIMMEDIATE;
- gad.GadgetType=PROPGADGET;
- gad.GadgetRender=(APTR)&Image1;
- gad.SelectRender=NULL;
- gad.GadgetText=NULL;
- gad.MutualExclude=NULL;
- gad.SpecialInfo=(APTR)∝
- gad.GadgetID=0;
- gad.UserData=0;
-
- prop.HorizPot=prop.HorizBody*current;
- AddGadget(win4,&gad,-1);
- RefreshGadgets(&gad,win4,NULL);
-
- str[0]=0;
- if (flag==1) strcpy(str,"Level");
- if (flag==2) strcpy(str,"Delay");
- if (flag==3) strcpy(str,"Attack");
- if (flag==4) strcpy(str,"Decay");
- if (flag==5) strcpy(str,"Sustain");
- if (flag==6) strcpy(str,"Release");
- if (flag==7) strcpy(str,"Level>Vel");
- if (flag==8) strcpy(str,"Level>Prs");
- if (flag==9) strcpy(str,"Level>KS ");
- if (flag==10) strcpy(str,"Time>Vel ");
- if (flag==11) strcpy(str,"Time>KS ");
- if (flag==12) strcpy(str,"KS>Freq ");
- if (flag==13) strcpy(str,"Coarse ");
- if (flag==14) strcpy(str,"Fine ");
- if (flag==15) strcpy(str,"Fixed key");
- if (flag==21) strcpy(str,"Vib-Speed");
- if (flag==22) strcpy(str,"Vib-Depth");
- if (flag==23) strcpy(str,"Prs>Depth");
- if (flag==30) strcpy(str,"Depth");
- if (flag==31) strcpy(str,"Time");
- if (flag==32) strcpy(str,"Vel>Depth");
- if (flag==33) strcpy(str,"KS>Time");
- if (flag==40) strcpy(str,"Pitchbend");
- if (flag==41) strcpy(str,"Prs>Freq");
- if (flag==42) strcpy(str,"Volume");
-
- Print(win4,10,9,&str[0]);
-
- val=prop.HorizPot/prop.HorizBody;
- DisplaySingleValue(flag,val);
-
- if (flag>=1 && flag<=6) EnvDisplay();
-
- loop: WaitPort(win4->UserPort);
- mesg=(struct IntuiMessage *) GetMsg(win4->UserPort);
-
- if (mesg->Class == GADGETDOWN)
- {
- ReplyMsg((struct Message *)mesg);
- while(gad.Flags & SELECTED)
- {
- val=prop.HorizPot/prop.HorizBody;
- ReturnValue(nr,flag,val);
- DisplaySingleValue(flag,val);
- if (flag>=1 && flag<=6) EnvDisplay();
- }
- goto loop;
- }
-
- if (mesg->Class == GADGETUP)
- {
- ReplyMsg((struct Message *)mesg);
- val=prop.HorizPot/prop.HorizBody;
- ReturnValue(nr,flag,val);
- DisplaySingleValue(flag,val);
- if (flag>=1 && flag<=6) EnvDisplay();
- goto loop;
- }
-
- if (mesg->Class == MOUSEBUTTONS && mesg->Code==MENUDOWN)
- {
- ReplyMsg((struct Message *)mesg);
- val=prop.HorizPot/prop.HorizBody;
-
- ReturnValue(nr,flag,val);
- if (flag>=1 && flag<=6) EnvDisplay();
- CloseWindow(win4);
- return();
- }
-
- ReplyMsg((struct Message *)mesg);
- goto loop;
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void DisplaySingleValue(const int flag,const long val)
- {
- char string[80];
-
- string[0]=0;
- if (flag==0) { sprintf(string,"%-16s",WaveName[val]); goto Print; }
- if (flag>=1 && flag<=6) { sprintf(string,"%3ld ",val); goto Print; }
- if (flag>=7 && flag<=12) { sprintf(string,"%3ld ",val-50); goto Print; }
- if (flag==13) { sprintf(string,"%3ld ",val-24); goto Print; }
- if (flag==14) { sprintf(string,"%3ld ",val-50); goto Print; }
- if (flag==15) { sprintf(string,"%2s%2ld",ToneName[val%12],(val/12)-4); goto Print; }
- if (flag==21) { sprintf(string,"%3ld ",val); goto Print; }
- if (flag>=22 && flag<=23) { sprintf(string,"%3ld ",val-50); goto Print; }
- if (flag==30) { sprintf(string,"%3ld ",val-50); goto Print; }
- if (flag==31) { sprintf(string,"%3ld ",val); goto Print; }
- if (flag==32) { sprintf(string,"%3ld ",val-50); goto Print; }
- if (flag==33) { sprintf(string,"%3ld ",val-50); goto Print; }
- if (flag==40) { sprintf(string,"%3ld ",val); goto Print; }
- if (flag==41) { sprintf(string,"%3ld ",val-50); goto Print; }
- if (flag==42) { sprintf(string,"%3ld ",val+1); goto Print; }
-
- Print: ;
- if (flag==0) Print(win4,5,9,string);
- if (flag==0)
- {
- sprintf(string,"%3ld",val+1);
- Print(win4,5,29,string);
- }
- if (flag != 0) Print(win4,95,9,string);
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void ReturnValue(const int nr,const int flag,const long val)
- {
- if (flag==0) { wave[nr] =val; goto Send; }
- if (flag==1) { envlevel[nr] =val; goto Send; }
- if (flag==2) { envdelay[nr] =val; goto Send; }
- if (flag==3) { envattack[nr] =val; goto Send; }
- if (flag==4) { envdecay[nr] =val; goto Send; }
- if (flag==5) { envsustain[nr] =val; goto Send; }
- if (flag==6) { envrelease[nr] =val; goto Send; }
- if (flag==7) { levelmodvel[nr] =val; goto Send; }
- if (flag==8) { levelmodprs[nr] =val; goto Send; }
- if (flag==9) { levelmodks[nr] =val; goto Send; }
- if (flag==10) { timemodvel[nr] =val; goto Send; }
- if (flag==11) { timemodks[nr] =val; goto Send; }
- if (flag==12) { freqksfreq[nr] =val; goto Send; }
- if (flag==13) { coarse[nr] =val+60; goto Send; }
- if (flag==14) { fine[nr] =val; goto Send; }
- if (flag==15) { coarse[nr] =val; goto Send; }
- if (flag==21) { lfospeed =val; goto Send; }
- if (flag==22) { vibdepth =val; goto Send; }
- if (flag==23) { vibpres =val; goto Send; }
- if (flag==30) { autodepth =val; goto Send; }
- if (flag==31) { autotime =val; goto Send; }
- if (flag==32) { autobendvel =val; goto Send; }
- if (flag==33) { autobendks =val; goto Send; }
- if (flag==40) { pitchbend =val; goto Send; }
- if (flag==41) { prsfreq =val; goto Send; }
- if (flag==42) { volume =val; goto Send; }
-
- Send: ;
- if (flag==0) { SingleParameterSend(35,nr,wave[nr]); return(); }
- if (flag==1) { SingleParameterSend(41,nr,envlevel[nr]); return(); }
- if (flag==2) { SingleParameterSend(42,nr,envdelay[nr]); return(); }
- if (flag==3) { SingleParameterSend(43,nr,envattack[nr]); return(); }
- if (flag==4) { SingleParameterSend(44,nr,envdecay[nr]); return(); }
- if (flag==5) { SingleParameterSend(45,nr,envsustain[nr]); return(); }
- if (flag==6) { SingleParameterSend(46,nr,envrelease[nr]); return(); }
- if (flag==7) { SingleParameterSend(48,nr,levelmodvel[nr]); return(); }
- if (flag==8) { SingleParameterSend(49,nr,levelmodprs[nr]); return(); }
- if (flag==9) { SingleParameterSend(50,nr,levelmodks[nr]); return(); }
- if (flag==10) { SingleParameterSend(51,nr,timemodvel[nr]); return(); }
- if (flag==11) { SingleParameterSend(52,nr,timemodks[nr]); return(); }
- if (flag==12) { SingleParameterSend(34,nr,freqksfreq[nr]); return(); }
- if (flag==13) { SingleParameterSend(28,nr,coarse[nr]); return(); }
- if (flag==14) { SingleParameterSend(30,nr,fine[nr]); return(); }
- if (flag==15) { SingleParameterSend(29,nr,coarse[nr]); return(); }
- if (flag==21) { SingleParameterSend(16,0,lfospeed); return(); }
- if (flag==22) { SingleParameterSend(15,0,vibdepth); return(); }
- if (flag==23) { SingleParameterSend(18,0,vibpres); return(); }
- if (flag==30) { SingleParameterSend(20,0,autodepth); return(); }
- if (flag==31) { SingleParameterSend(21,0,autotime); return(); }
- if (flag==32) { SingleParameterSend(22,0,autobendvel); return(); }
- if (flag==33) { SingleParameterSend(23,0,autobendks); return(); }
- if (flag==40) { SingleParameterSend(25,0,pitchbend); return(); }
- if (flag==41) { SingleParameterSend(24,0,prsfreq); return(); }
- if (flag==42) { SingleParameterSend(3,0,volume); return(); }
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void EncodeSingle(const int nr)
- {
- int i,sum;
-
- if (nr>128) /* user cancel */
- {
- for (i=0;i<=87;i++) s[(nr-128)/32][(nr-128)%32][i]=f[i];
- TransmitSingleSound(nr-128);
- return();
- }
-
- RefreshGadgets(&Gadget1,win,NULL);
- volume=99-Gadget1SInfo.VertPot/656;
- volume=volume >99 ? 99 : volume;
- for (i=0;i<=9;i++) if(s[nr/32][nr%32][i]==0) s[nr/32][nr%32][i]=32;
-
- s[nr/32][nr%32][10]=volume;
- s[nr/32][nr%32][11]=polymode+sources*4+ams1*8+ams2*32;
- s[nr/32][nr%32][12]=prsfreq;
- s[nr/32][nr%32][13]=vibdepth;
- s[nr/32][nr%32][14]=vibpres;
- s[nr/32][nr%32][15]=pitchbend;
- s[nr/32][nr%32][16]=lfospeed;
- s[nr/32][nr%32][17]=lfoshape+4*kscurve+32*vibwheel;
- s[nr/32][nr%32][18]=autodepth;
- s[nr/32][nr%32][19]=autotime;
- s[nr/32][nr%32][20]=autobendvel;
- s[nr/32][nr%32][21]=autobendks;
- s[nr/32][nr%32][22]=mute[0]+mute[1]*2+mute[2]*4+mute[3]*8;
-
- for (i=0;i<=3;i++)
- {
- s[nr/32][nr%32][23+i]= fine[i]%128;
- s[nr/32][nr%32][27+i]= coarse[i]%128;
- s[nr/32][nr%32][31+i]= wave[i]%128;
- s[nr/32][nr%32][35+i]=((wave[i]/128)+keytrack[i]*2+vibabend[i]*4+prsonfreq[i]*8+velcurve[i]*16)&127;
-
- s[nr/32][nr%32][39+i]= envlevel[i];
- s[nr/32][nr%32][43+i]= envdelay[i];
- s[nr/32][nr%32][47+i]= envattack[i];
- s[nr/32][nr%32][51+i]= envdecay[i];
- s[nr/32][nr%32][55+i]= envsustain[i];
- s[nr/32][nr%32][59+i]= envrelease[i];
-
- s[nr/32][nr%32][63+i]= levelmodvel[i];
- s[nr/32][nr%32][67+i]= levelmodprs[i];
- s[nr/32][nr%32][71+i]= levelmodks[i];
- s[nr/32][nr%32][75+i]= timemodvel[i];
- s[nr/32][nr%32][79+i]= timemodks[i];
- s[nr/32][nr%32][83+i]= freqksfreq[i];
- }
-
- sum=0xa5; /* Prüfsumme berechnen */
- for (i=0;i<=86;i++) sum=(sum+s[nr/32][nr%32][i]) & 127;
- s[nr/32][nr%32][87]=sum;
-
- TransmitSingleSound(nr);
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void NumBox(int x,int y,int wide,char *s,int val)
- {
- char string[10];
-
- MakeBox(win,x,y,x+wide,y+10);
- sprintf(string,"%3d",val);
- Print(win,x+wide-30,y+8,string);
- Print(win,x+4,y+8,s);
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- int Check(int x,int y,int xmin,int xmax,int ymin,int ymax)
- {
- if (x>xmin && x<xmax && y>ymin && y<ymax) return(1);
- else return(0);
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void DisplaySingleLine(int pos)
- {
- char str[80];
- int i;
-
- if (sources==0)
- {
- SetAPen(win->RPort,0);
- SetBPen(win->RPort,0);
- SetOPen(win->RPort,0);
- RectFill(win->RPort,311,100,616,250);
- RectFill(win->RPort,151,86,259,95);
- SetAPen(win->RPort,1);
- }
-
-
- if (pos==4)
- {
- Print(win,40,18,"Vibrato-LFO");
- MakeBox(win,20,20,150,30);
- Print(win,24,28,"Shape :");
- Print(win,120,28,ShapeName[lfoshape]);
- NumBox(20,30,130,"Speed :",lfospeed);
- NumBox(20,40,130,"Depth :",vibdepth-50);
- NumBox(20,50,130,"Prs>Depth :",vibpres-50);
- MakeBox(win,20,60,150,70);
- Print(win,24,68,"Vib wheel : ");
- if (vibwheel==0) strcpy(str,"Dep");
- else strcpy(str,"Spd");
- Print(win,120,68,str);
-
- Print(win,170,18,"Auto-Bend");
- NumBox(150,20,110,"Depth :",autodepth-50);
- NumBox(150,30,110,"Time :",autotime);
- NumBox(150,40,110,"Vel>Dep :",autobendvel-50);
- NumBox(150,50,110,"KS>Time :",autobendks-50);
- NumBox(150,60,110,"Prs>Freq:",prsfreq-50);
-
- NumBox(20,75,130,"Pitchbend :",pitchbend);
- NumBox(20,85,130,"Volume :",volume+1);
-
- MakeBox(win,150,75,260,85);
- Print(win,154,83,"S1.S2 :");
- Print(win,230,83,ModName[ams1]);
-
- if (sources != 0)
- {
- MakeBox(win,150,85,260,95);
- Print(win,154,93,"S3.S4 :");
- Print(win,230,93,ModName[ams2+3]);
- }
-
- MakeBox(win,260,75,390,85);
- Print(win,264,83,"Polymode:");
- Print(win,340,83,PolyName[polymode]);
- MakeBox(win,260,85,390,95);
- Print(win,264,93,"Sources :");
- if (sources==0) Print(win,360,93,"2");
- else Print(win,360,93,"4");
-
-
- MakeBox(win,390,75,455,95); /* KS */
- SetAPen(win->RPort,0);
- SetBPen(win->RPort,0);
- SetOPen(win->RPort,0);
- RectFill(win->RPort,391,76,454,94);
- SetAPen(win->RPort,1);
- sprintf(str,"KS %1d",kscurve+1);
- Print(win,393,83,str);
- for (i=0;i<=2;i++)
- {
- int x1,y1,x2,y2;
-
- x1=390+VCvec[kscurve][2*i]*65/130;
- y1=75+VCvec[kscurve][2*i+1]*20/32;
- x2=390+VCvec[kscurve][2*i+2]*65/130;
- y2=75+VCvec[kscurve][2*i+3]*20/32;
- Line(win,x1,y1,x2,y2);
- }
-
- MakeBox(win,260,20,455,75); /* Envelope */
- Print(win,330,18,"Envelope");
- EnvDisplay();
-
- }
- else if ((sources==0 && pos<2) || (sources==1 && pos<4))
- {
- MakeBox(win,150*pos+20,100,150*pos+155,110);
- for (i=0;i<=3;i++) Line(win,150*pos+20+i*33,100,150*pos+20+i*33,110);
- Print(win,150*pos+20+6,108, "Mut");
- Print(win,150*pos+20+33+5,108, "Key");
- Print(win,150*pos+20+2*33+5,108,"Vib");
- Print(win,150*pos+20+3*33+6,108,"Prs");
- MakeBox(win,150*pos+20,110,150*pos+155,120);
- for (i=0;i<=3;i++) Line(win,150*pos+20+i*33,110,150*pos+20+i*33,120);
-
- if (mute[pos]==1) Print(win,150*pos+20+5,118,"Off");
- else Print(win,150*pos+20+5,118,"On ");
-
- if (keytrack[pos]==1) Print(win,150*pos+20+34+4,118,"On ");
- else Print(win,150*pos+20+34+4,118,"Off");
-
- if (vibabend[pos]==1) Print(win,150*pos+20+2*34+3,118,"On ");
- else Print(win,150*pos+20+2*34+3,118,"Off");
-
- if (prsonfreq[pos]==1) Print(win,150*pos+20+3*34+3,118,"On ");
- else Print(win,150*pos+20+3*34+3,118,"Off");
-
- SetAPen(win->RPort,0);
- SetBPen(win->RPort,0);
- SetOPen(win->RPort,0);
- RectFill(win->RPort,150*pos+111,121,150*pos+153,149);
- SetAPen(win->RPort,1);
- MakeBox(win,150*pos+110,120,150*pos+155,150);
- sprintf(str,"Vel %d",velcurve[pos]+1);
- Print(win,150*pos+113,128,str);
- for (i=0;i<=2;i++)
- {
- int x1,y1,x2,y2;
- x1=150*pos+110+VCvec[velcurve[pos]][2*i]*45/130;
- y1=120+VCvec[velcurve[pos]][2*i+1]*30/32;
- x2=150*pos+110+VCvec[velcurve[pos]][2*i+2]*45/130;
- y2=120+VCvec[velcurve[pos]][2*i+3]*30/32;
- Line(win,x1,y1,x2,y2);
- }
-
- if (keytrack[pos]==1) NumBox(150*pos+20,120,90,"Coarse:",coarse[pos]-84);
- else
- {
-
- sprintf(str,"Fix : %2s%2ld",ToneName[coarse[pos]%12],(coarse[pos]/12)-4);
- Print(win,150*pos+20+4,128,str);
- MakeBox(win,150*pos+20,120,150*pos+110,130);
- }
- NumBox(150*pos+20,130,90,"Fine :",fine[pos]-50);
- NumBox(150*pos+20,140,90,"Level :",envlevel[pos]);
- MakeBox(win,150*pos+20,150,150*pos+155,160);
- strcpy(str,WaveName[wave[pos]]);
- strcat(str," ");
- str[16]=0;
- Print(win,150*pos+24,158,str);
-
- SetAPen(win->RPort,2);
- MakeBox(win,150*pos+10,165,150*pos+160,185);
- SetAPen(win->RPort,1);
- Line(win,11,175,300*(sources+1)+9,175);
- for (i=1;i<=4;i++) Line(win,150*pos+10+30*i,165,150*pos+10+30*i,185);
- Print(win,150*pos+14 ,173,"Del");
- Print(win,150*pos+44 ,173,"Att");
- Print(win,150*pos+74 ,173,"Dec");
- Print(win,150*pos+104,173,"Sus");
- Print(win,150*pos+134,173,"Rel");
- sprintf(str,"%3d",envdelay[pos]);
- Print(win,150*pos+14,183,str);
- sprintf(str,"%3d",envattack[pos]);
- Print(win,150*pos+44,183,str);
- sprintf(str,"%3d",envdecay[pos]);
- Print(win,150*pos+74,183,str);
- sprintf(str,"%3d",envsustain[pos]);
- Print(win,150*pos+104,183,str);
- sprintf(str,"%3d",envrelease[pos]);
- Print(win,150*pos+134,183,str);
-
- NumBox(150*pos+20,190,135,"Level>Vel :",levelmodvel[pos]-50);
- NumBox(150*pos+20,200,135,"Level>Prs :",levelmodprs[pos]-50);
- NumBox(150*pos+20,210,135,"Level>KS :",levelmodks[pos]-50);
- NumBox(150*pos+20,220,135,"Time>Vel :",timemodvel[pos]-50);
- NumBox(150*pos+20,230,135,"Time>KS :",timemodks[pos]-50);
- NumBox(150*pos+20,240,135,"KS>Freq :",freqksfreq[pos]-50);
- }
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void MakeBox(struct Window *win,long x1,long y1,long x2,long y2)
- {
- Line(win,x1,y1,x2,y1);
- Line(win,x2,y1,x2,y2);
- Line(win,x2,y2,x1,y2);
- Line(win,x1,y2,x1,y1);
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void MakeDBox(struct Window *win,long x1,long y1,long x2,long y2)
- {
- Line(win,x1,y1,x2,y1);
- Line(win,x2,y1,x2,y2);
- Line(win,x2,y2,x1,y2);
- Line(win,x1,y2,x1,y1);
-
- Line(win,x1+1,y1-1,x2+1,y1-1);
- Line(win,x2+1,y1-1,x2+1,y2-1);
- Line(win,x2+2,y1-1,x2+2,y2-2);
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void SingleParameterSend(int nr,int src,int val)
- {
- int i;
- unsigned char buf[10];
-
- buf[0]=0xf0; buf[1]=0x40; buf[2]=MASTERCHANNEL; buf[3]=0x10;
- buf[4]=0x00; buf[5]=0x03; buf[6]=nr; buf[7]=src*2+(val/128);
- buf[8]=val%128; buf[9]=0xf7;
-
- PutMidiMsg(source,buf);
- Delay(1);
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void TestSound(int channel)
- {
- ZZ_POINTER(win);
- NoteOn(60,64,channel);
- Delay(25);
- NoteOn(64,64,channel);
- Delay(25);
- NoteOn(67,64,channel);
- Delay(25);
- NoteOn(72,64,channel);
- Delay(50);
- AllNotesOff();
-
- NoteOn(60,64,channel);
- NoteOn(64,64,channel);
- NoteOn(67,64,channel);
- NoteOn(72,64,channel);
- Delay(50);
- AllNotesOff();
- CLEAR_POINTER(win);
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void Oscillators(void)
- {
-
- int ergebnis,i,source,dest,id;
- static char oscstr[4][4];
- char string[255];
- struct NewWindow nw;
- struct Window *WIN;
- static struct RastPort *RP;
- static struct GadgetBlock buf[4];
-
- struct TRStructure TxReq = { 0,0,0,0,0,0,NULL,0xFFFF,0,0,0,0,0,0 };
-
- TxReq.Text = "Select oscillator operation";
- TxReq.NegativeText = "Cancel";
- TxReq.PositiveText = "Copy";
- TxReq.MiddleText = "Swap";
- TxReq.Title = NULL;
- TxReq.versionnumber = REQVERSION;
- TxReq.Timeout = 25;
- TxReq.Window = win;
-
- ergebnis=TextRequest(&TxReq);
- if (ergebnis==0) goto EndeOsci;
-
- source=0;
- dest=0;
-
- nw.Width = 145;
- nw.Height = 28;
- nw.DetailPen = 0;
- nw.BlockPen = 1;
- nw.Title ="Source oscillator";
- nw.Flags = RMBTRAP|ACTIVATE|REPORTMOUSE|SMART_REFRESH|WINDOWDRAG;
- nw.IDCMPFlags = MOUSEBUTTONS|GADGETUP|GADGETDOWN;
- nw.Type = (SCREEN != 0 ? CUSTOMSCREEN : WBENCHSCREEN);
- nw.CheckMark = NULL;
- nw.NextGadget=NULL;
- nw.Screen = (SCREEN != 0 ? scr : NULL);
- nw.BitMap = NULL;
- nw.MinWidth = 0;
- nw.MinHeight = 0;
- nw.MaxWidth = 0;
- nw.MaxHeight = 0;
-
- nw.FirstGadget=NULL;
- for (i=0;i<=2*sources+1;i++)
- {
- sprintf(oscstr[i],"%2d",i+1);
- MakeGadget(&buf[i],&oscstr[i][0],30*i+20,15);
- buf[i].Gadget.GadgetID=i+1;
- buf[i].Gadget.NextGadget=nw.FirstGadget;
- nw.FirstGadget=&buf[i].Gadget;
- }
-
- nw.LeftEdge=440;
- nw.TopEdge=85;
- WIN=(struct Window *) OpenWindow(&nw);
- if (WIN==NULL) Error("Can't open source-window");
- RP=WIN->RPort;
- SetFont(RP,textfont);
-
- OsciLoop: ;
- WaitPort(WIN->UserPort);
- mesg=(struct IntuiMessage *) GetMsg(WIN->UserPort);
- class=mesg->Class;
- code=mesg->Code;
- id=mesg->IAddress->GadgetID;
- ReplyMsg((struct Message *)mesg);
-
- switch(class)
- {
- case MOUSEBUTTONS:
- {
- if (code==MENUDOWN)
- {
- CloseWindow(WIN);
- return();
- }
- break;
- }
-
- case GADGETUP:
- {
- source=id-1;
- CloseWindow(WIN);
- goto OsciLoop1;
-
- break;
- }
-
- default: goto OsciLoop;
- }
- goto OsciLoop;
-
- OsciLoop1: ;
- nw.LeftEdge=440;
- nw.TopEdge=85;
- nw.Title ="Dest. oscillator";
- WIN=(struct Window *) OpenWindow(&nw);
- if (WIN==NULL) Error("Can't open destination-window");
- RP=WIN->RPort;
- SetFont(RP,textfont);
-
- osciLoop: ;
- WaitPort(WIN->UserPort);
- mesg=(struct IntuiMessage *) GetMsg(WIN->UserPort);
- class=mesg->Class;
- code=mesg->Code;
- id=mesg->IAddress->GadgetID;
- ReplyMsg((struct Message *)mesg);
-
- switch(class)
- {
- case MOUSEBUTTONS:
- {
- if (code==MENUDOWN)
- {
- CloseWindow(WIN);
- return();
- }
- break;
- }
-
- case GADGETUP:
- {
- dest=id-1;
- if (dest==source)
- {
- MyReq("Source and destination\noscillator must be\ndifferent !",NULL,"Go on");
- goto osciLoop;
- }
- CloseWindow(WIN);
- goto EndeOsci;
-
- break;
- }
- default: goto osciLoop;
- }
- goto osciLoop;
-
- EndeOsci: ;
-
- if (ergebnis==1) /* Oscillator-Copy */
- {
- mute[dest] = mute[source];
- keytrack[dest] = keytrack[source];
- vibabend[dest] = vibabend[source];
- prsonfreq[dest] = prsonfreq[source];
- velcurve[dest] = velcurve[source];
- coarse[dest] = coarse[source];
- fine[dest] = fine[source];
- envlevel[dest] = envlevel[source];
- wave[dest] = wave[source];
- envdelay[dest] = envdelay[source];
- envattack[dest] = envattack[source];
- envdecay[dest] = envdecay[source];
- envsustain[dest] = envsustain[source];
- envrelease[dest] = envrelease[source];
- levelmodvel[dest] = levelmodvel[source];
- levelmodprs[dest] = levelmodprs[source];
- levelmodks[dest] = levelmodks[source];
- timemodvel[dest] = timemodvel[source];
- timemodks[dest] = timemodks[source];
- freqksfreq[dest] = freqksfreq[source];
- }
-
- if (ergebnis==2) /* Oscillator-Swap */
- {
- Swap(&mute[source] ,&mute[dest]);
- Swap(&keytrack[source] ,&keytrack[dest]);
- Swap(&vibabend[source] ,&vibabend[dest]);
- Swap(&prsonfreq[source] ,&prsonfreq[dest]);
- Swap(&velcurve[source] ,&velcurve[dest]);
- Swap(&coarse[source] ,&coarse[dest]);
- Swap(&fine[source] ,&fine[dest]);
- Swap(&envlevel[source] ,&envlevel[dest]);
- Swap(&wave[source] ,&wave[dest]);
- Swap(&envdelay[source] ,&envdelay[dest]);
- Swap(&envattack[source] ,&envattack[dest]);
- Swap(&envdecay[source] ,&envdecay[dest]);
- Swap(&envsustain[source] ,&envsustain[dest]);
- Swap(&envrelease[source] ,&envrelease[dest]);
- Swap(&levelmodvel[source] ,&levelmodvel[dest]);
- Swap(&levelmodprs[source] ,&levelmodprs[dest]);
- Swap(&levelmodks[source] ,&levelmodks[dest]);
- Swap(&timemodvel[source] ,&timemodvel[dest]);
- Swap(&timemodks[source] ,&timemodks[dest]);
- Swap(&freqksfreq[source] ,&freqksfreq[dest]);
- }
- }
-
- /**********************************************************************************/
- /*** ***/
- /**********************************************************************************/
-
- void Swap(int *a,int *b)
- {
- int h;
-
- h=*a;
- *a=*b;
- *b=h;
- }
-